package handler;

/*import com.xl.sdk.annotations.SDKAnswer;*/

/**
 * @author xienan
 * @date 2020-01-08 17:41
 */
/*@SDKAnswer*/
public class KstartDefultResponse {


   /* @SDKAnswerMap(CmdEnum.XblueMotorcyclesLoginParam)
    public Object login(XblueSDKInpuStream in, XblueSDKOutputStream out) throws Exception {
        System.out.println();
        return null;
    }*/


//    @SDKAnswerMap(CmdEnum.Xbluetim)
//    public Object timeSyn(KstarSDKInputStream in, KstarSDKOutputStream out){
//        System.out.println("---------------------------------接收到对时指令----------------------------------------");
//        System.out.println("请求电桩地址：" + in.getKstarEndpoint().getLocalAddress().getAddress());
//        System.out.println("请求报文：" + ByteBufUtil.hexDump(in.getMsg().toByteArray()));
//        TimingParams timingConfirmParams = (TimingParams)in.getKstarSDKParams();
//        System.out.println("确认结果：" + timingConfirmParams.getConfirm());
//        System.out.println("---------------------------------接收到对时指令----------------------------------------");
//        return null;
//    }
//
//
//
////    @SDKAnswerMapping(CommandContext.HEART_BEAT)
//    @SDKAnswerMap(CmdEnum.KstarHEART_BEAT)
//    public Object heartBeart(KstarSDKInputStream in, KstarSDKOutputStream out) throws Exception {
//        System.out.println("---------------------------------接收到心跳报文----------------------------------------");
//        System.out.println("请求电桩地址：" + in.getKstarEndpoint().getLocalAddress().getAddress());
//        System.out.println("请求报文：" + ByteBufUtil.hexDump(in.getMsg().toByteArray()));
//        HeartbeatParams heartbeatParams = (HeartbeatParams)in.getKstarSDKParams();
//        System.out.println("电桩运行时间（s）：" + heartbeatParams.getUptime());
//        System.out.println("心跳间隔时间：" + heartbeatParams.getInterval());
//        HeartbeatParams heartbeatConfirmParams = heartbeatParams.transfer(heartbeatParams,HeartbeatParams.class);
//        heartbeatConfirmParams.setCmdSource(0);
//        heartbeatConfirmParams.setTranType(1);
//        out.write(heartbeatConfirmParams,in.getKstarEndpoint());
//        System.out.println("---------------------------------接收到心跳报文----------------------------------------");
//        return null;
//    }
//
////    @SDKAnswerMapping(CommandContext.UPLOAD_REAL_TIME_DATA)
//    @SDKAnswerMap(CmdEnum.KstarUPLOAD_REAL_TIME_DATA)
//    public Object realData(KstarSDKInputStream in, KstarSDKOutputStream out) throws Exception {
//        System.out.println("接收到实时数据报文");
//        LiveDataParams liveDataParams = (LiveDataParams)in.getKstarSDKParams();
//        System.out.println("---------------------------------接收到实时数据----------------------------------------");
//        System.out.println("|电桩号：" + liveDataParams.getTerminalNo() + "|电桩状态:" + liveDataParams.getDevStatus());
//        System.out.println("|充电卡号：" + liveDataParams.getCardNo() + "|车辆 VIN:" + liveDataParams.getVin());
//        System.out.println("|充电电压：" + liveDataParams.getOutVoltage() + "|充电电流:" + liveDataParams.getCurrent());
//        System.out.println("|充电时间：" + liveDataParams.getTime() + "|充电金额:" + liveDataParams.getMoney());
//        System.out.println("|充电电能：" + liveDataParams.getPower() + "|充电剩余时间:" + liveDataParams.getRemTime());
//        System.out.println("|充电卡余额：" + liveDataParams.getCardValue() + "|充电卡类型:" + liveDataParams.getCardType());
//        System.out.println("|充电方式：" + liveDataParams.getChargerType() + "|充电模式:" + liveDataParams.getChargerMode());
//        System.out.println("|需求电压：" + liveDataParams.getVoltegeReq() + "|需求电流:" + liveDataParams.getCurrentReq());
//        System.out.println("|车位状态：" + liveDataParams.getLockStatus() + "|电能表读数:" + liveDataParams.getCuurentPowerValue());
//        System.out.println("|充电输出电压：" + liveDataParams.getOutVoltage() + "|充电输出电流:" + liveDataParams.getOutCurrent());
//        System.out.println("|枪正极温度：" + liveDataParams.getPosTem() + "|枪负极温度:" + liveDataParams.getNegTem());
//        System.out.println("|电池充电模式：" + liveDataParams.getBatMode() + "|电池允许充电:" + liveDataParams.getBatAllow());
//        System.out.println("|最高允许充电电压：" + liveDataParams.getMaxAllowVoltage() + "|最高允许充电电流:" + liveDataParams.getMaxAllowCurrent());
//        System.out.println("|整车动力蓄电池当前电池电压：" + liveDataParams.getCurrentBatVoltage() + "|电池单体最高电压:" + liveDataParams.getOneBatMaxVoltage());
//        System.out.println("|电池单体最低电压：" + liveDataParams.getOneBatMinVoltage() + "|电池单体最高温度:" + liveDataParams.getOneBatMaxTem());
//        System.out.println("|电池单体最低温度：" + liveDataParams.getOneBatMinTem() + "|充电桩温度:" + liveDataParams.getPileTem());
//        System.out.println("|soc：" + liveDataParams.getSoc() + "|当前充电模式" + liveDataParams.getMod());
//        System.out.println("cachekey：" + liveDataParams.getTerminalNo() + "-" + liveDataParams.getGun());
//        System.out.println("---------------------------------接收到实时数据----------------------------------------");
//        System.out.println();
//
////        System.out.println(liveDataParams.toString());
//        return null;
//    }
//
////    @SDKAnswerMapping(CommandContext.UPLOAD_ALARM_DATA)
//    @SDKAnswerMap(CmdEnum.KstarUPLOAD_ALARM_DATA)
//    public Object caution(KstarSDKInputStream in, KstarSDKOutputStream out) throws Exception {
//
//        CautionParam cautionParam = (CautionParam)in.getKstarSDKParams();
//        System.out.println("---------------------------接收到告警数据------------------------------------");
//        System.out.println("|告警类型:" + cautionParam.getCautionType() + "|告警原因:" + cautionParam.getCautionReason());
//        System.out.println("|告警开始时间:" + cautionParam.getCautionStartTime().toString() + "|告警结束时间:" + cautionParam.getCautionEndTime().toString());
//        System.out.println("|告警持续时间:" + cautionParam.getCautionDuration().toString() + "|告警是否影响充电:" + cautionParam.getIsAffectCharging());
//        System.out.println("告警是否上传:" + cautionParam.getIsUpload());
//        System.out.println("---------------------------接收到告警数据------------------------------------");
//
//        CautionParam cautionConfim = cautionParam.transfer(cautionParam,CautionParam.class);
//        cautionConfim.setCount(cautionParam.getCount());
//        cautionConfim.setMarkId(cautionParam.getRemarkId());
//        cautionConfim.setSaveId(cautionParam.getRemarkId());
//        cautionConfim.setTranType(1);
//        cautionConfim.setCmdSource(0);
//
//        out.write(cautionConfim,in.getKstarEndpoint());
//        return null;
//    }
//
//
////    @SDKAnswerMapping(CommandContext.UPLOAD_HISTORICAL_DATA)
//    @SDKAnswerMap(CmdEnum.KstarUPLOAD_HISTORICAL_DATA)
//    public Object historyOrder(KstarSDKInputStream in, KstarSDKOutputStream out) throws Exception {
//
//        HistoryOrderParams historyOrderParams = (HistoryOrderParams)in.getKstarSDKParams();
//        System.out.println("---------------------------接收到历史数据------------------------------------");
//        System.out.println("|充电前金额：" + historyOrderParams.getBeforMoney() + "|订单号：" + historyOrderParams.getOrderNo());
//        System.out.println("|充电卡号：" + historyOrderParams.getCardNo() + "|充电方式：" + historyOrderParams.getChargeType());
//        System.out.println("|充电模式：" + historyOrderParams.getChargeMode() + "|充点卡类型：" + historyOrderParams.getCardType());
//        System.out.println("|充电卡号：" + historyOrderParams.getCardNo() + "|充电电压：" + historyOrderParams.getVoltage());
//        System.out.println("|充电电流：" + historyOrderParams.getCurrent() + "|充电金额：" + historyOrderParams.getMoney());
//        System.out.println("|充电电能：" + historyOrderParams.getPower() + "|开始充电电能：" + historyOrderParams.getBeforePower());
//        System.out.println("|剩余时间：" + historyOrderParams.getRemTime() + "|是否付费：" + historyOrderParams.getPay());
//        System.out.println("|充电终止原因：" + historyOrderParams.getCompletion() + "|充电开始时间：" + historyOrderParams.getStartTime());
//        System.out.println("|充电结束时间：" + historyOrderParams.getEndTime());
//        System.out.println("|记录存储序号：" + historyOrderParams.getSeqNo());
//        System.out.println("|停止原因：" + historyOrderParams.getStopReason());
//        System.out.println("---------------------------接收到历史数据------------------------------------");
//
//        HistoryOrderParams hiconfirm = new HistoryOrderParams();
//
//        hiconfirm = historyOrderParams.transfer(historyOrderParams,HistoryOrderParams.class);
//        hiconfirm.setCount(historyOrderParams.getCount());
//        hiconfirm.setRecordNo(0);
//        hiconfirm.setResseqNo(historyOrderParams.getSeqNo());
//        hiconfirm.setResult(0);
//        hiconfirm.setTranType(1);
//        hiconfirm.setCmdSource(0);
//        out.write(hiconfirm,in.getKstarEndpoint());
//        return null;
//    }
//
//
////    @SDKAnswerMapping(CommandContext.UPLOAD_SWIPE_REQUEST)
//    @SDKAnswerMap(CmdEnum.KstarUPLOAD_SWIPE_REQUEST)
//    public Object ICCardCmd(KstarSDKInputStream in, KstarSDKOutputStream out) throws Exception{
//        ICCardParam icCardParam = (ICCardParam)in.getKstarSDKParams();
//        System.out.println("---------------------------接收到刷卡请求------------------------------------");
//        System.out.println("|请求电桩终端号：" + icCardParam.getTerminalNo() + "|请求卡号：" + icCardParam.getCardNo());
//        System.out.println("---------------------------接收到刷卡请求------------------------------------");
//
//
//
//        ICCardParam icCardParamResult = icCardParam.transfer(icCardParam,ICCardParam.class);
//
//        icCardParamResult.setCardNo(icCardParam.getCardNo());
//
//        icCardParamResult.setCardStatul((byte)1);
//        icCardParamResult.setMoney(500);
//        icCardParamResult.setLeastMoney(100);
//        icCardParamResult.setTransactionFlow(1101);
//
//        out.write(icCardParamResult,in.getKstarEndpoint());
//
//        return null;
//    }
}
